
import sys

#RabbitMQ操作类
from RabbitUtil import RabbitUtil
#参数获取类
from Config      import *
from SpiderUtil import *


#使用RabbitMQ，插入省信息
def InsertDetail(AuctionList):
    #获得配置参数
    RabbitParam = Config["RabbitMQ"];
    #初始化Rabbit
    RabbitH = RabbitUtil(host=RabbitParam["host"], user=RabbitParam["user"], passwd=RabbitParam["passwd"], vhost=RabbitParam["vhost"]);
    #创建省信息队列

    IP = "127.0.0.1".replace(".", "_");
    QueueName = Config["Spider"]["jddqName"]+IP
    # QueueName = Config["Spider"]["alidqName"]+IP
    
    RabbitH.Produce(QueueName, AuctionList);

    # RabbitH.CreateQueues(["QueueDetail"]);
    # RabbitH.Produce("QueueDetail", AuctionList);
    #end

#测试
import time
if __name__ == "__main__":
    #插入待获取省列表


    # InsertDetail(["https://paimai.jd.com/296318868"]);
    InsertDetail(["https://paimai.jd.com/296822430"])

    # args = sys.argv
    # InsertDetail(args[1].split(","))

    print("add detail success")

